package cn.zhangtiancinb.simple_demo.dubbo.consumer;

import javax.annotation.Resource;

import com.alibaba.dubbo.config.annotation.Reference;

import cn.hutool.core.bean.BeanUtil;
import org.springframework.stereotype.Service;
import cn.zhangtianci.simple_demo.dubbo.api.ApiService;
import cn.zhangtiancinb.simple_demo.exception_switch.client.ExceptionSwitchUtil;

/**
 * 消费服务实现
 *
 * @author 张天赐
 */
@Service
public class ConsumerServiceImpl implements ConsumerService {
    @Reference
    private ApiService apiService;
    @Resource
    ExceptionSwitchConfigProperties exceptionSwitchConfig;

    @Override
    public String call(int value) {
        ExceptionSwitchUtil.getInstance(BeanUtil.beanToMap(exceptionSwitchConfig)).callQuickly("应用[simple_demo.dubbo_consumer]服务[consumer]方法[call]");
        return apiService.call(value);
    }
}
